package com.ruoyi.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.T25Mapper;
import com.ruoyi.domain.T25;
import com.ruoyi.service.IT25Service;
import org.springframework.util.ObjectUtils;

/**
 * 套餐Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-13
 */
@Service
public class T25ServiceImpl implements IT25Service
{
    @Autowired
    private T25Mapper t25Mapper;

    /**
     * 查询套餐
     *
     * @param F2501 套餐主键
     * @return 套餐
     */
    @Override
    public T25 selectT25ByF2501(Long F2501)
    {
        return t25Mapper.selectT25ByF2501(F2501);
    }

    /**
     * 查询套餐列表
     *
     * @param t25 套餐
     * @return 套餐
     */
    @Override
    public List<T25> selectT25List(T25 t25)
    {
        return t25Mapper.selectT25List(t25);
    }

    /**
     * 新增套餐
     *
     * @param t25 套餐
     * @return 结果
     */
    @Override
    public int insertT25(T25 t25)
    {
        T25 t251 = t25Mapper.selectT25ByF2502(t25.getF2502());
        if(!ObjectUtils.isEmpty(t251)){
            throw new RuntimeException("该金额的套餐已存在");
        }
        return t25Mapper.insertT25(t25);
    }

    /**
     * 修改套餐
     *
     * @param t25 套餐
     * @return 结果
     */
    @Override
    public int updateT25(T25 t25)
    {
        return t25Mapper.updateT25(t25);
    }

    /**
     * 批量删除套餐
     *
     * @param F2501s 需要删除的套餐主键
     * @return 结果
     */
    @Override
    public int deleteT25ByF2501s(Long[] F2501s)
    {
        return t25Mapper.deleteT25ByF2501s(F2501s);
    }

    /**
     * 删除套餐信息
     *
     * @param F2501 套餐主键
     * @return 结果
     */
    @Override
    public int deleteT25ByF2501(Long F2501)
    {
        return t25Mapper.deleteT25ByF2501(F2501);
    }

    @Override
    public T25 selectT25ByF2502(Long f2502) {
        return t25Mapper.selectT25ByF2502(f2502);
    }
}
